package com.apcc4m.sfpush;

import com.apcc4m.sfpush.bean.ServerListenerInfo;
import com.apcc4m.sfpush.listener.NettyServerListener;
import com.apcc4m.sfpush.service.MessageService;

public class ServerApp {

    public static void main(String[] args) {
        new ServerApp().initService();
    }

    /**
     * 初始化服务
     */
    private void initService() {
        ServerListenerInfo info = new ServerListenerInfo();
        // 设置收到消息后处理业务逻辑的类
        info.setServiceClass(MessageService.class);

        info.setMainPort(SfpushConst.MAIN_PORT);
        // 用于分配处理业务线程的线程组个数
        info.setMainGroupSize(Runtime.getRuntime().availableProcessors() * 2);
        info.setMainThreadSize(1000);

        new NettyServerListener().init(info);
    }
}
